/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.dahg.project.web;

import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import org.dahg.project.controller.model.Categoria;
import org.dahg.project.controller.model.services.local.MenuService;

/**
 *
 * @author dahg
 */
@ManagedBean
@ViewScoped
public class MenuBean extends AbstractWebBean {
    
    @EJB
    private MenuService service;
    
    private List<Categoria> categorias;
    private Categoria selected;
    
    @PostConstruct
    public void init() {
        categorias = service.getAllCategorias();
        
        if(categorias!=null && !categorias.isEmpty())
            selected = categorias.get(0);
    }
    
    public List<Categoria> getCategorias() {
        return categorias;
    }

    public Categoria getSelected() {
        return selected;
    }

    public void setSelected(Categoria selected) {
        this.selected = selected;
    }
    
    
}
